home *** CD-ROM | disk | FTP | other *** search
/ Mac OS on the PowerPC Mic…rocessor - In Store Demo / Mac OS on the PowerPC Microprocessor.iso / MacOS / MacOS.dxr / 00098_120_bookmark_script.ls < prev    next >
Encoding:
Text File  |  1996-05-13  |  1.8 KB  |  62 lines

  1. property iCurrentChapter, iCurrentParagraph, iVisitedMarkList, iMaxChapter, iMaxParagraphList, objMisc, iPreferenceFileName, iPreferenceFolder, iAllMarkList, iPreferenceExist, iUserName, iSavePreference
  2. global objfileio, galllessonlist, gBookmarkLoc, gGraphicPath, gDelimiter, onIBM
  3.  
  4. on birth me
  5.   set iCurrentChapter to 0
  6.   set iCurrentParagraph to 0
  7.   set iVisitedMarkList to []
  8.   set iMaxChapter to count(galllessonlist)
  9.   set iMaxParagraphList to []
  10.   repeat with tChapter = 1 to iMaxChapter
  11.     add(iMaxParagraphList, getAt(getAt(galllessonlist, tChapter), 2))
  12.   end repeat
  13.   set objMisc to birth(script "Misc_script")
  14.   set iPreferenceFileName to EMPTY
  15.   mGetPreferenceFile(me)
  16.   return me
  17. end
  18.  
  19. on mGetMaxChapter me
  20.   return iMaxChapter
  21. end
  22.  
  23. on mGetMaxParagraph me, tChapter
  24.   return getAt(iMaxParagraphList, tChapter)
  25. end
  26.  
  27. on mGetStatus me, tChapter, tParagraph
  28.   set tVisited to getAt(getAt(iVisitedMarkList, tChapter), tParagraph)
  29.   if tVisited then
  30.     return #VISITED
  31.   else
  32.     return #NORMAL
  33.   end if
  34. end
  35.  
  36. on mGetPreferenceFile me
  37.   mNewUser(me)
  38. end
  39.  
  40. on mNewUser me
  41.   set iVisitedMarkList to []
  42.   repeat with tChapter = 1 to iMaxChapter
  43.     set tMaxParagraph to getAt(iMaxParagraphList, tChapter)
  44.     set tVisitedmarkList to []
  45.     if tMaxParagraph <> 0 then
  46.       setAt(tVisitedmarkList, tMaxParagraph, 0)
  47.     end if
  48.     add(iVisitedMarkList, tVisitedmarkList)
  49.   end repeat
  50. end
  51.  
  52. on mSetVisited me, tChapter, tParagraph
  53.   setAt(getAt(iVisitedMarkList, tChapter), tParagraph, 1)
  54. end
  55.  
  56. on mSetBookMark me, tChapter, tParagraph
  57.   set tNewBookmarkStatus to not getAt(getAt(iBookMarkList, tChapter), tParagraph)
  58.   set tVisitedmarkStatus to getAt(getAt(iVisitedMarkList, tChapter), tParagraph)
  59.   setAt(getAt(iBookMarkList, tChapter), tParagraph, tNewBookmarkStatus)
  60.   return list(tNewBookmarkStatus, tVisitedmarkStatus)
  61. end
  62.